Reasons for NSManagedObjectMergeError error on [NSManagedObjectContext save:]

Posted by ross-kimes on Stack Overflow See other posts from Stack Overflow or by ross-kimes
Published on 2010-04-17T00:55:20Z Indexed on 2010/04/17 1:03 UTC
Read the original article Hit count: 732

Filed under:
|
|
|

I have a application that combines threading and CoreData. I and using one global NSPersistentStoreCoordinator and a main NSManagedObjectContextModel.

I have a process where I have to download 9 files simultaneously, so I created an object to handle the download (each individual download has its own object) and save it to the persistentStoreCoordinator. In the [NSURLConnection connectionDidFinishLoading:] method, I created a new NSManagedObject and attempt to save the data (which will also merge it with the main managedObjectContext).

I think that it is failing due to multiple process trying to save to the persistentStoreCoordinator at the same time as the downloads are finishing around the same time. What is the easiest way to eliminate this error and still download the files independently?

Thank you!

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about core-data